package com.hlkj.baojin.utils.bean;


import java.util.Random;
import java.util.UUID;


/**
 * @author liu-zhong-xin
 * @createDate 2018/2/5 0005
 * uuid生成
 */
public class IdGenerator {

    private static String randNumString = "0123456789";


    /**
     * 获得一个UUID
     *
     * @return String UUID
     */
    public static String getUUID() {
        String uuid = UUID.randomUUID().toString();
        //去掉“-”符号
        return uuid.replaceAll("-", "");
    }


    /**
     * 获取六位数字
     * @return
     */
    public static String getInviteCode(){
        StringBuilder inviteCode = new StringBuilder();
        for(int i=0;i<6;i++){
            inviteCode.append(String.valueOf(String.valueOf(randNumString.charAt(new Random().nextInt(randNumString.length())))));
        }
        return inviteCode.toString();
    }
}
